{extend name='main'}

{block name='style'}
<style>
    .layui-table-body tr .layui-table-cell{
        height: 100px;
        line-height: 100px;
    }
</style>
{/block}

{block name="button"}
{if auth("add")}
<button data-open='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
{/if}


{/block}

{block name='content'}
<!-- 页面内容部分 -->
<div class="think-box-shadow">
    <table class="layui-table layui-form" id="tree-table" lay-size="sm"></table>
    <script type="text/html" id="barDemo">

    </script>

</div>

<script>

    layui.config({
        base: '__ROOT__/static/plugs/layui/bin/treeTable/'
    }).extend({
        treeTable:'treeTable'
    }).use(['treeTable'], function () {
        var treeTable = layui.treeTable;
        treeTable.render({
            elem: '#tree-table',
            url: "{:url('admin/city/getTreeData')}",
            icon_key: 'name',
            parent_key: 'parent_id',
            top_value: 100000,
            // is_checkbox: true,
            checked: {
                key: 'id',
                data: [],
            },
            cols: [
                {key: 'id', title: 'ID', width: '50px'},
                {key: 'name', title: '名称', width: '150px'},
                {
                    title: '操作',
                    align: 'center',
                    width: '150px',
                    template: function (item) {
                        return '<a class="layui-btn layui-btn-xs" data-modal="{:url("edit")}?id=' + item.id + '">编 辑</a>';
                    }
                }
            ],
            end: function (e) {
                form.render();
            },
        });
    })

</script>

{/block}

{/block}